<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>yili的个人小站</title><meta name="author" content="yili"><meta name="copyright" content="yili"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="身骑白马">
<meta property="og:type" content="website">
<meta property="og:title" content="yili的个人小站">
<meta property="og:url" content="https://yili979.gitee.io/blog/page/2/index.html">
<meta property="og:site_name" content="yili的个人小站">
<meta property="og:description" content="身骑白马">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://i.loli.net/2021/10/05/BKpC6sFEo5Dl7qA.jpg">
<meta property="article:author" content="yili">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://i.loli.net/2021/10/05/BKpC6sFEo5Dl7qA.jpg"><link rel="shortcut icon" href="/blog/img/favicon.ico"><link rel="canonical" href="https://yili979.gitee.io/blog/page/2/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/blog/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/blog/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#121212","position":"bottom-left"},
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: true
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'yili的个人小站',
  isPost: false,
  isHome: true,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2022-03-08 20:42:16'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const fontSizeVal = saveToLocal.get('global-font-size')
    if (fontSizeVal !== undefined) {
      document.documentElement.style.setProperty('--global-font-size', fontSizeVal + 'px')
    }
    
    const detectApple = () => {
      if (GLOBAL_CONFIG_SITE.isHome && /iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><link rel="stylesheet" href="/blog/css/custom.css" media="defer" onload="this.media='all'"><meta name="generator" content="Hexo 5.4.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://i.loli.net/2021/10/05/BKpC6sFEo5Dl7qA.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/blog/archives/"><div class="headline">文章</div><div class="length-num">28</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/blog/tags/"><div class="headline">标签</div><div class="length-num">20</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/blog/categories/"><div class="headline">分类</div><div class="length-num">13</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/blog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/blog/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/blog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/blog/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/blog/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header" style="background-image: url('/blog/img/index.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/blog/">yili的个人小站</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/blog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/blog/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/blog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/blog/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/blog/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">yili的个人小站</h1><div id="site-subtitle"><span id="subtitle"></span></div></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left_radius"><a href="/blog/2021/10/06/golang/golang%E5%9F%BA%E7%A1%80-3-%E6%95%B0%E7%BB%84/" title="golang基础-3-数组">     <img class="post_bg" src="https://i.loli.net/2021/10/06/muj2EqIY5PxMsZh.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="golang基础-3-数组"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/2021/10/06/golang/golang%E5%9F%BA%E7%A1%80-3-%E6%95%B0%E7%BB%84/" title="golang基础-3-数组">golang基础-3-数组</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-06T13:50:11.000Z" title="发表于 2021-10-06 21:50:11">2021-10-06</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/blog/categories/go/">go</a></span></div><div class="content">数组
又是老生常谈的数组

之前说的还是有些问题，这个语言不只是变量方面奇怪，各个方面都很奇怪。开发这个语言的人一定是一个特立独行的人吧 bushi）
声明和初始化下面是三种基础新建数组的方式：
1234567var balance [10]float64var balance = make([]int,10)var balance = [5]float32&#123;1.0, 1.1, 1.2, 1.3, 1.4&#125;//可以根据输入的数目来进行创建var balance = []int&#123;1, 2, 3, 4&#125;//可以使用对应的索引来进行创建var balance = []int &#123;4:100&#125;

基于以上，可以不指定数组的长度，但是一定要在后面一个大括号说明要加入进来的东西。
数组的遍历数组的遍历可以使用正常的for语句来进行遍历，同时也可以使用range语句来进行遍历。
1234567a := [...]int&#123;12, 78, 50&#125; // ... makes the compiler determine the  ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/blog/2021/10/06/golang/golang%E5%9F%BA%E7%A1%80-2-%E6%B5%81%E7%A8%8B%E8%AF%AD%E5%8F%A5/" title="golang基础-2-流程语句">     <img class="post_bg" src="https://i.loli.net/2021/10/06/muj2EqIY5PxMsZh.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="golang基础-2-流程语句"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/2021/10/06/golang/golang%E5%9F%BA%E7%A1%80-2-%E6%B5%81%E7%A8%8B%E8%AF%AD%E5%8F%A5/" title="golang基础-2-流程语句">golang基础-2-流程语句</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-06T13:49:50.000Z" title="发表于 2021-10-06 21:49:50">2021-10-06</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/blog/categories/go/">go</a></span></div><div class="content">流程语句if语句在Go中，if语句和其他语言的使用方式大致相同，

不同点：

不需要加括号
可以在if语句中加一个分号，前面的表达式当作常规表达式，后面的表达式作为判断语句


switch语句switch语句中，没有break这个说法。
如果哪个语句符合就直接执行那个语句即可。
如果需要继续执行下去，则需要在语句中添加一个fallthrough继续向下执行。
12345678910111213141516171819202122232425262728293031package mainimport &quot;fmt&quot;func main() &#123;    var grade string    var marks = 90    switch marks &#123;    case 90:        grade = &quot;A&quot;    case 80:        grade = &quot;B&quot;    case 50, 60, 70:        grade = &quot;C&quot;    default:         ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/blog/2021/10/06/golang/golang%E5%9F%BA%E7%A1%80-1-%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/" title="golang基础-1-基础语法">     <img class="post_bg" src="https://i.loli.net/2021/10/06/muj2EqIY5PxMsZh.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="golang基础-1-基础语法"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/2021/10/06/golang/golang%E5%9F%BA%E7%A1%80-1-%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/" title="golang基础-1-基础语法">golang基础-1-基础语法</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-06T13:49:21.000Z" title="发表于 2021-10-06 21:49:21">2021-10-06</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/blog/categories/go/">go</a></span></div><div class="content">题外话如果你想对GO进行安装并使用，直接在go的中文官网下载对应的版本，然后配置以下环境变量，如果需要使用编译器，推荐两个：VScode和Goland
如果使用Goland，可以做到开箱即用，如果使用vscode，则需要在你的GoPath文件夹打开，随意新建一个go文件，然后vscode会提示你安装插件，在国内是无法正常安装的，需要你输入以下的命令：
12go env -w GO111MODULE=ongo env -w GOPROXY=https://goproxy.io,direct

输入命令后，直接点击import all即可。之后你便可以愉快的在vscode上使用go进行开发了。
基础语法变量单变量声明我觉得在golang中最反人类的一点就是它对变量的使用，使用JS的形式在最前面加一个var，然后将数据的类型放在最后面。导致这个语言十分的“耐人寻味”。当然了，喜欢的人会特别喜欢，仁者见仁智者见智，不对这个语法做过多的评价，功能强大才是硬道理。
第一种对变量声明的方式：
12345//var name type//name = valuevar name stringname  ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/blog/2021/10/05/%E5%A4%9A%E7%BA%BF%E7%A8%8B-ThreadLocal/" title="ThreadLocal简介">     <img class="post_bg" src="https://i.loli.net/2021/10/06/nNuTKYH48X3mvLo.png" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="ThreadLocal简介"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/2021/10/05/%E5%A4%9A%E7%BA%BF%E7%A8%8B-ThreadLocal/" title="ThreadLocal简介">ThreadLocal简介</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-05T04:54:11.000Z" title="发表于 2021-10-05 12:54:11">2021-10-05</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/blog/categories/java%E5%9F%BA%E7%A1%80/">java基础</a></span></div><div class="content">ThreadLocal1.是什么ThreadLocal是一个线程局部模型，在多线程的场景中应用十分广泛。 一个ThreadLocal中存在着多个线程所保存的映射，通过将线程的引用加入，可以通过线程的引用作为key来查找map中存在的值。

  注意：
  一个线程可以有多个ThreadLocal，一个ThreadLocal可以保存多个Thread，所以它们之间是多数对多数的关系。
  如果想查找一个线程中的一个ThreadLocal中的值时。

2.ThreadLocal方法set()方法
12345678public void set(T value) &#123;    Thread t = Thread.currentThread();    ThreadLocalMap map = getMap(t);    if (map != null)        map.set(this, value);    else        createMap(t, value);&#125;

分析：

  首先通过currentThread获取当前操作的线程
  通过线程来获得一个Th ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/blog/2021/10/05/spring/SpringBoot%E6%B3%A8%E8%A7%A3%E8%AF%A6%E8%A7%A3/" title="SpringBoot注解详解">     <img class="post_bg" src="https://i.loli.net/2021/10/05/h7PclqueaK3tHzY.png" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="SpringBoot注解详解"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/2021/10/05/spring/SpringBoot%E6%B3%A8%E8%A7%A3%E8%AF%A6%E8%A7%A3/" title="SpringBoot注解详解">SpringBoot注解详解</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-04T16:22:31.000Z" title="发表于 2021-10-05 00:22:31">2021-10-05</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/blog/categories/SpringBoot/">SpringBoot</a></span></div><div class="content">SpringBoot注解详解启动类注解@SpringBootApplication主配置类：
12345678@SpringBootApplicationpublic class MallDemoApplication &#123;    public static void main(String[] args) &#123;        SpringApplication.run(MallDemoApplication.class, args);    &#125;&#125;

让我们进入SpringBootApplication
1234567@SpringBootConfiguration@EnableAutoConfiguration@ComponentScan(    excludeFilters = &#123;@Filter(    type = FilterType.CUSTOM,    classes = &#123;TypeExcludeFilter.class&#125;)

可以得到三个主要的注解结构：

SpringBootConfiguration
表 ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/blog/2021/10/05/jvm/JVM-%E5%86%85%E5%AD%98%E5%8C%BA%E5%9F%9F/" title="JVM-内存区域">     <img class="post_bg" src="https://i.loli.net/2018/11/05/5bdfce578c055.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="JVM-内存区域"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/2021/10/05/jvm/JVM-%E5%86%85%E5%AD%98%E5%8C%BA%E5%9F%9F/" title="JVM-内存区域">JVM-内存区域</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-04T16:19:22.000Z" title="发表于 2021-10-05 00:19:22">2021-10-05</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/blog/categories/JVM/">JVM</a></span></div><div class="content">Java内存区域运行时数据区域
1.程序计数器程序计数器在JVM中时线程独占的
,执行跳转,分支,循环,等条件.PC register,相当于汇编语言中的寄存器.
通过汇编语言可知,寄存器所占的空间一般都很小,所以不会出现存储值的溢出情况.
2.虚拟机栈这个栈同样相当于汇编语言中的栈,JVM会为每个方法的执行中分配栈帧,以便于使用栈的空间.栈的主要功能是分配局部变量的空间,以及充当传递参数的区域以及存放返回值的区域.
Java虚拟机栈中会存在两种错误信息,分别是:StackOverFlowError和OutOfMemoryError

StackOverFlowError： 若 Java 虚拟机栈的内存大小不允许动态扩展，那么当线程请求栈的深度超过当前 Java 虚拟机栈的最大深度的时候，就抛出 StackOverFlowError 错误。
OutOfMemoryError： Java 虚拟机栈的内存大小可以动态扩展， 如果虚拟机在动态扩展栈时无法申请到足够的内存空间，则抛出OutOfMemoryError异常。

任何形式的栈结束都会存在两种条件:分别是出现异常和得到返回值
3.本地 ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/blog/2021/10/05/jvm/JVM-%E5%9E%83%E5%9C%BE%E5%9B%9E%E6%94%B6/" title="JVM-垃圾回收">     <img class="post_bg" src="https://i.loli.net/2021/10/06/nNuTKYH48X3mvLo.png" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="JVM-垃圾回收"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/2021/10/05/jvm/JVM-%E5%9E%83%E5%9C%BE%E5%9B%9E%E6%94%B6/" title="JVM-垃圾回收">JVM-垃圾回收</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-04T16:16:56.000Z" title="发表于 2021-10-05 00:16:56">2021-10-05</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/blog/categories/JVM/">JVM</a></span></div><div class="content">垃圾回收对象已死两种回收策略1.引用计数器法如果一个地方进行引用则会加一，一个地方的引用取消则会减一。
注意：如果出现相互引用的情况，则会出现这两个引用都不会被垃圾回收
123456789101112public class StringDemo &#123;    public StringDemo instance = null;        public static void main(String[] args) &#123;        StringDemo stringDemo1 = new StringDemo();        StringDemo stringDemo2 = new StringDemo();        stringDemo1.instance = stringDemo2;        stringDemo2.instance = stringDemo1;        stringDemo1 = null;        stringDemo2 = null;    &#125;&#125;

2.可达性分析算法
在java技术中，可固 ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/blog/2021/10/05/jvm/JVM-%E7%B1%BB%E5%8A%A0%E8%BD%BD%E8%BF%87%E7%A8%8B/" title="JVM-类加载过程">     <img class="post_bg" src="https://i.loli.net/2021/10/05/Lf36O8MDvnZux2A.png" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="JVM-类加载过程"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/2021/10/05/jvm/JVM-%E7%B1%BB%E5%8A%A0%E8%BD%BD%E8%BF%87%E7%A8%8B/" title="JVM-类加载过程">JVM-类加载过程</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-04T16:14:36.000Z" title="发表于 2021-10-05 00:14:36">2021-10-05</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/blog/categories/JVM/">JVM</a></span></div><div class="content">类加载过程

1.加载（Loading）1）通过类的全限定名得到类的二进制文件信息，这个二进制文件信息是可以通过多种方式来得到的
2）将类的静态信息装载到方法区中
3）在内存中生成这个类的java.lang.class的信息，作为读取这个类的信息的接口
下面是介绍的可以得到二进制流的方式

2.验证验证阶段是较为重要的一个阶段，是因为如果这个类不满足jvm处理的规范，则可能会发生某些不可逆的异常，会对生产环境造成某些不可逆的影响。
而验证主要分为以下几个阶段：
1）文件格式验证：验证这个文件是否满足版本号的规定
2）元数据验证：比如这个类所引用的数据是否满足规范（如果一个类继承一个final类是不允许的）
3）字节码验证：对这个class所进行的操作进行判断，比如对一个栈的调用是否符合规范等
4）符号引用验证：该类是否缺少或者被禁止访问它依赖的某些外部类、方法、字段等资源。符号所引用的值是否可以找到对应的值，所引用的值是否可以被当前类进行访问。
3.准备对类的对象进行基础赋值（但是不包括final类型的常量值，常量值会直接在运行时常量池进行处理）

在JDK 7及之前，HotSpot使 ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/blog/2021/10/05/nosql/Redis%E5%9F%BA%E7%A1%80/" title="Redis基础">     <img class="post_bg" src="https://i.loli.net/2021/10/04/R5mOBnMaeyZ7cpT.png" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="Redis基础"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/2021/10/05/nosql/Redis%E5%9F%BA%E7%A1%80/" title="Redis基础">Redis基础</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-04T16:06:51.000Z" title="发表于 2021-10-05 00:06:51">2021-10-05</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/blog/categories/Redis/">Redis</a></span></div><div class="content">Redis基础五个基本Redis数据结构（官网信息）
首先对redis来说，所有的key（键）都是字符串。我们在谈基础数据结构时，讨论的是存储值的数据类型，主要包括常见的5种数据类型，分别是：String、List、Set、Zset、Hash。




结构类型
结构存储的值
结构的读写能力



String字符串
可以是字符串、整数或浮点数
对整个字符串或字符串的一部分进行操作；对整数或浮点数进行自增或自减操作；


List列表
一个链表，链表上的每个节点都包含一个字符串
对链表的两端进行push和pop操作，读取单个或多个元素；根据值查找或删除元素；


Set集合
包含字符串的无序集合
字符串的集合，包含基础的方法有看是否存在添加、获取、删除；还包含计算交集、并集、差集等


Hash散列
包含键值对的无序散列表
包含方法有添加、获取、删除单个元素


Zset有序集合
和散列一样，用于存储键值对
字符串成员与浮点数分数之间的有序映射；元素的排列顺序由分数的大小决定；包含方法有添加、获取、删除单个元素以及根据分值范围或成员来获取元素



内容其实比较简单，我觉得理解的重点在 ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/blog/2021/10/05/java/Java8%E6%B5%81%E5%A4%84%E7%90%86/" title="Java8流处理">     <img class="post_bg" src="https://i.loli.net/2021/10/04/7PWqmtGLMs3hign.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="Java8流处理"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/2021/10/05/java/Java8%E6%B5%81%E5%A4%84%E7%90%86/" title="Java8流处理">Java8流处理</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-04T16:03:45.000Z" title="发表于 2021-10-05 00:03:45">2021-10-05</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/blog/categories/Java-8/">Java 8</a></span></div><div class="content">Stream流的介绍在Java8中新增加了一个十分简化的操作：Stream
可以使用一种较为方便的方式来对集合中的数据进行处理。所以Stream也被称之为高级迭代器。
流的顺序是不可改变的：
filter–&gt;map–&gt;limit–&gt;collect

外部迭代和内部迭代：
外部迭代就是使用for-each来对数据进行处理，在一个for循环中对数据进行处理，其在底层使用的是迭代器的语法糖模式。
内部迭代是通过map，filter，collect等流操作来对数据进行处理。

流的处理
使用流包括三个操作：

对数据源进行查询操作
中间链式操作
终端操作


使用流筛选和切片1.distinct：将相同的数据进行筛选
12345678910public class FilterTest &#123;    public static void main(String[] args) &#123;        List&lt;Integer&gt; list = Arrays.asList(1, 2, 4, 5, 6, 7);        list.stream()     ...</div></div></div><nav id="pagination"><div class="pagination"><a class="extend prev" rel="prev" href="/blog/"><i class="fas fa-chevron-left fa-fw"></i></a><a class="page-number" href="/blog/">1</a><span class="page-number current">2</span><a class="page-number" href="/blog/page/3/#content-inner">3</a><a class="extend next" rel="next" href="/blog/page/3/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://i.loli.net/2021/10/05/BKpC6sFEo5Dl7qA.jpg" onerror="this.onerror=null;this.src='/blog/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">yili</div><div class="author-info__description">身骑白马</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/blog/archives/"><div class="headline">文章</div><div class="length-num">28</div></a></div><div class="card-info-data-item is-center"><a href="/blog/tags/"><div class="headline">标签</div><div class="length-num">20</div></a></div><div class="card-info-data-item is-center"><a href="/blog/categories/"><div class="headline">分类</div><div class="length-num">13</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/qiuyuyin"><i class="fab fa-github"></i><span>github🍟</span></a></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">啦啦啦，写的不好还请见谅😉<div class="twopeople"><div class="twopeople"><div class="container"style="height:200px;"><canvas class="illo"width="800"height="800"style="max-width: 200px; max-height: 200px; touch-action: none; width: 640px; height: 640px;"></canvas></div><script src="js/twopeople1.js"></script><script src="js/zdog.dist.js"></script><script id="rendered-js"src="js/twopeople.js"></script><style>.twopeople{margin:0;align-items:center;justify-content:center;text-align:center}canvas{display:block;margin:0 auto;cursor:move}</style></div></div></div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/blog/2022/03/08/something-about-crypto/" title="something about crypto"><img src="https://yili979.oss-cn-beijing.aliyuncs.com/img/image-20220124000713258.png" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="something about crypto"/></a><div class="content"><a class="title" href="/blog/2022/03/08/something-about-crypto/" title="something about crypto">something about crypto</a><time datetime="2022-03-08T12:01:13.000Z" title="发表于 2022-03-08 20:01:13">2022-03-08</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2022/03/08/golang%E5%86%85%E5%AD%98%E7%AE%A1%E7%90%86/" title="golang内存管理"><img src="https://yili979.oss-cn-beijing.aliyuncs.com/img/202203081958270.png" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="golang内存管理"/></a><div class="content"><a class="title" href="/blog/2022/03/08/golang%E5%86%85%E5%AD%98%E7%AE%A1%E7%90%86/" title="golang内存管理">golang内存管理</a><time datetime="2022-03-08T11:55:30.000Z" title="发表于 2022-03-08 19:55:30">2022-03-08</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2022/03/08/%E9%89%B4%E6%9D%83%E7%B3%BB%E7%BB%9F/" title="鉴权系统"><img src="https://yili979.oss-cn-beijing.aliyuncs.com/img/202203081950401.jpeg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="鉴权系统"/></a><div class="content"><a class="title" href="/blog/2022/03/08/%E9%89%B4%E6%9D%83%E7%B3%BB%E7%BB%9F/" title="鉴权系统">鉴权系统</a><time datetime="2022-03-08T11:49:53.000Z" title="发表于 2022-03-08 19:49:53">2022-03-08</time></div></div></div></div><div class="card-widget card-categories"><div class="item-headline">
            <i class="fas fa-folder-open"></i>
            <span>分类</span>
            <a class="card-more-btn" href="/blog/categories/" title="查看更多">
    <i class="fas fa-angle-right"></i></a>
            </div>
            <ul class="card-category-list" id="aside-cat-list">
            <li class="card-category-list-item "><a class="card-category-list-link" href="/blog/categories/JVM/"><span class="card-category-list-name">JVM</span><span class="card-category-list-count">3</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/blog/categories/Java-8/"><span class="card-category-list-name">Java 8</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/blog/categories/Java-NIO/"><span class="card-category-list-name">Java NIO</span><span class="card-category-list-count">2</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/blog/categories/MongoDB/"><span class="card-category-list-name">MongoDB</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/blog/categories/Mysql/"><span class="card-category-list-name">Mysql</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/blog/categories/Redis/"><span class="card-category-list-name">Redis</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/blog/categories/SpringBoot/"><span class="card-category-list-name">SpringBoot</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/blog/categories/go/"><span class="card-category-list-name">go</span><span class="card-category-list-count">7</span></a></li>
            </ul></div><div class="card-widget card-tags"><div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div><div class="card-tag-cloud"><a href="/blog/tags/IO/" style="font-size: 1.1em; color: #999">IO</a> <a href="/blog/tags/JVM/" style="font-size: 1.37em; color: #99a4b2">JVM</a> <a href="/blog/tags/Java8/" style="font-size: 1.1em; color: #999">Java8</a> <a href="/blog/tags/MongoDB/" style="font-size: 1.1em; color: #999">MongoDB</a> <a href="/blog/tags/Netty/" style="font-size: 1.1em; color: #999">Netty</a> <a href="/blog/tags/Redis/" style="font-size: 1.1em; color: #999">Redis</a> <a href="/blog/tags/SpringBoot/" style="font-size: 1.1em; color: #999">SpringBoot</a> <a href="/blog/tags/crypto/" style="font-size: 1.1em; color: #999">crypto</a> <a href="/blog/tags/go/" style="font-size: 1.5em; color: #99a9bf">go</a> <a href="/blog/tags/golang/" style="font-size: 1.23em; color: #999ea6">golang</a></div></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/blog/archives/2022/03/"><span class="card-archive-list-date">三月 2022</span><span class="card-archive-list-count">4</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/blog/archives/2022/01/"><span class="card-archive-list-date">一月 2022</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/blog/archives/2021/10/"><span class="card-archive-list-date">十月 2021</span><span class="card-archive-list-count">22</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">28</div></div><div class="webinfo-item"><div class="item-name">本站总字数 :</div><div class="item-count">48.8k</div></div><div class="webinfo-item"><div class="item-name">本站访客数 :</div><div class="item-count" id="busuanzi_value_site_uv"></div></div><div class="webinfo-item"><div class="item-name">本站总访问量 :</div><div class="item-count" id="busuanzi_value_site_pv"></div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2022-03-08T12:42:16.474Z"></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2022 By yili</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="font-plus" type="button" title="放大字体"><i class="fas fa-plus"></i></button><button id="font-minus" type="button" title="缩小字体"><i class="fas fa-minus"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/blog/js/utils.js"></script><script src="/blog/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"><script>function subtitleType () {
  if (true) { 
    var typed = new Typed("#subtitle", {
      strings: "我一路向北&#44;离开有你的季节".split(","),
      startDelay: 300,
      typeSpeed: 150,
      loop: false,
      backSpeed: 50
    })
  } else {
    document.getElementById("subtitle").innerHTML = '我一路向北&#44;离开有你的季节'
  }
}

if (true) {
  if (typeof Typed === 'function') {
    subtitleType()
  } else {
    getScript('https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js').then(subtitleType)
  }
} else {
  subtitleType()
}</script></div><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>